package com.mdtx.utils;

import java.io.File;

/**
 * 文件工具类
 *
 * @author 猫啊
 * @create 2017-09-13 18:31
 **/
public class FileUtil {

    public static void mkdir(String path){
        File file = new File(path);

        if(!file.exists()){
            file.mkdirs();
        }

    }


    public static String assemblePath(String packages, String path){

        if(StringUtil.isEmpty(packages) || StringUtil.isEmpty(path)){
            return "";
        }

        String[] nameArr = StringUtil.splitPackage(packages);

        StringBuffer allPath = new StringBuffer(path);


        for (int i = 0; i < nameArr.length; i++) {
            allPath.append("\\"+nameArr[i]);
        }

        return allPath.toString();

    }

    public static void main(String[] args) {
       // mkdir("D:\\com\\mdtx\\business");
       // mkdir("D:\\com\\mdtx\\business\\entity");
       // mkdirPackage("com.mdtx.business","D:\\java");
    }
}
